#include <iostream>
#include <memory>
#include "TcpServer.hpp"
#include "Err.hpp"
#include "Task.hpp"

using namespace std;
using namespace YZCTcpServer;

static void Usage(const string &proc)
{
    std::cerr << "Usage:\n\t" << proc << " port" << endl;
}

//./server + 端口
int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }

    unique_ptr<TcpServer> svr(new TcpServer(Calculate, atoi(argv[1])));
    svr->InitServer();
    svr->Dispatcher();
    return 0;
}